package models

import "encoding/json"

type Attribute struct {
	Username               string `json:"username,omitempty"`
	ClientId               string `json:"client_id,omitempty"`
	AuthorizationGrantType string `json:"authorization_grant_type,omitempty"`
	RedirectUri            string `json:"redirect_uri,omitempty"`
	Scopes                 string `json:"scopes,omitempty"`
	CodeExpireTime         int64  `json:"code_expire_time,omitempty"`
}

func (a *Attribute) Serialize() string {
	attSer, err := json.Marshal(&a)
	if err != nil {
		return ""
	}
	return string(attSer)
}

func (a *Attribute) Deserialize(attSer string) error {
	return json.Unmarshal([]byte(attSer), &a)
}
